<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-dns-prefetch-control" content="on"/>
        <meta name="apple-mobile-web-app-capable" content="yes"/>
        <meta content="telephone=no" name="format-detection"/>
        <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
        <title><%=nodeName%>折扣，领券立减-优品镇</title>
        <meta name="Keywords" content=",优品镇"/>
        <meta name="Description" content="优品镇-优惠券折扣直播第一站！每天更新千款，纯人工筛选验货，限时限量特卖，全场1折包邮！"/>
        <script src="js/jquery.2.0.min.js"></script>
        <link href="css/wap_common.css" rel="stylesheet">
        <link href="css/wapcat.css" rel="stylesheet"/>
        <script src="js/lazyload.js" ></script>
    </head>
    <body>
        <div class="main-title clearfix">
            <a href="javascript:void(0)" class="main-back"></a>
            <div class="menu-cat">
                <span id="menu-cat-btn"><%=nodeName%><i></i></span>
            </div>
            <a class="mui-action-menu main-home" href="/"></a>
        </div>
        <!-- 主界面具体展示内容 -->
        <div class="order-nav">
    <ul>

        <li class="cur" id='nav1'>
            <span><a href="/cat.html?node=<%=node%>&px=1">综合</a></span>
        </li>
        <li class="" id='nav2'>
            <span><a href="/cat.html?node=<%=node%>&px=2">最新</a></span>
        </li>
        <li class="" id='nav3'>
            <span><a href="/cat.html?node=<%=node%>&px=3">销量</a></span>
        </li>
        <li class="" id='nav4'>
            <span><a href="/cat.html?node=<%=node%>&px=4">价格</a></span>
        </li>
    </ul>
</div>
<div class="goods-list" data-page="2">
<% result.data.forEach(function(item){ %>  
<div class="goods-item">
<a href="/det.html?id=<%=item.id%>" class="img">
<span class="today-wrapper">
<span>小编</span>
<span>精选</span>
</span>
<span class="coupon-wrapper">
<span class="coupon" style="color: #EDFF00;">独家券</span>
<span class="price"><%=item.goods_coupons %>元</span>
</span>
<img src="<%=item.pict_url %>" alt="">
</a>
<a href="<%=item.coupons_promote_url%>" class="title">
<div class="text" style=" color:#777777;"><%= item.goods_title%></div>
</a>
<div class="price-wrapper">
<span class="text">券后</span>
<span class="price">￥<%=item.cprice %></span>
<div class="sold-wrapper">
<span class="sold-num"><%= item.month_sales%></span>
<span class="text">人已买</span>
</div>
</div>
</div>
<% }) %>   
</div>

<div style="height: 100px;display: block;line-height: 100px;color: #565656;text-align: center;background-color: #fff;"
     class="pullup-goods">
    <div class="label" id="msg">商品加载中...</div>
</div>
<script language="javascript">

if(window.history.state){
$('.goods-list').html(window.history.state.list);
var page = window.history.state.page;
}else{
var page = 2;
}
    var isFinish = false;
    var isLoading = false;
    var $pullUp = null;
    var needLoadMore = false;

    var maxScrollY = 0;
    var windowHeight = 0;
    var cid = '<%=node %>';
    var px = '<%=px%>';
    var maxId = 1000;
    $(document).ready(function () {
        if('<%=px%>'!=''){
            $('.order-nav li').removeClass('cur');
            $('#nav'+'<%=px%>').addClass('cur');
        }

        maxScrollY = $(document).height();
        windowHeight = $(window).height();
        $(window).on('resize', function () {
            windowHeight = $(window).height();
        });
    $(window).scroll(function (e) {
            if (isFinish || isLoading) {
                return;
            }
            var y = $(document).scrollTop();
            maxScrollY = $(document).height();
            windowHeight = $(window).height();
            if (Math.abs(maxScrollY - windowHeight - y) > 100) {
                return;
            }
            var $wrapper = $(this);
            if (!$pullUp) {
                $pullUp = $wrapper.find('.pullup-goods');
            }
            var data = null;
            getData($wrapper, data, 1);
        });

        function getData($wrapper, data, direction) {
            if (isFinish) {
                return;
            }
            isLoading = true;
            if (!$pullUp) {
                $pullUp = $wrapper.find('.pullup-goods');
            }
            var labelTag = $($pullUp).find('.label');
            var tPaht="/cat.html";
            $.ajax(tPaht,{
                data: {r:'index/ajaxCat',pageNo: page, node: cid,px:px,maxId:maxId},
                dataType: 'json',
                type: 'post',
                error: function (xhr, type, errorThrown) {
                    getData($wrapper, data, direction);
                },
                success: function (result, status, xhr) {
                    needLoadMore = false;
                    if (result.ret == 0&&result.data.length>0) {
                        var data = result.data;

                        for (var i = data.length - 1; i >= 0; i--) {
                            var item = data[i];
                             var goodsItem=$('<div class="goods-item"></div>');                            
                            var d='<a href=/det.html?id='+item.id+' class="img">'+
                                    '<span class="today-wrapper">'+
                                    '<span>小编</span>'+
                                    '<span>精选</span>'+
                                    '</span>'+
                                    '<span class="coupon-wrapper">'+
                                    '<span class="coupon" style="color: #EDFF00;">独家券</span>'+
                                    '<span class="price">'+item.goods_coupons +'元</span>'+
                                    '</span>'+
                                    '<img src="'+item.pict_url +'" alt="">'+
                                    '</a>'+
                                    '<a href="'+item.coupons_promote_url+'" class="title">'+
                                    '<div class="text" style=" color:#777777;">'+ item.goods_title+'</div>'+
                                    '</a>'+
                                    '<div class="price-wrapper">'+
                                    '<span class="text">券后</span>'+
                                    '<span class="price">￥'+item.cprice +'</span>'+
                                    '<div class="sold-wrapper">'+
                                    '<span class="sold-num">'+item.month_sales+'</span>'+
                                    '<span class="text">人已买</span>'+
                                    '</div>'+
                                    '</div>';
                            goodsItem.append(d);
                            $('.goods-list').append(goodsItem);
                        }
//                        myScroll.refresh();
                            $("img.lazy").lazyload();
                            aClick();
                        maxScrollY = $(document).height();
                        isLoading = false;
                        page++;
                        //                        $(labelTag).html('上拉加载更多商品');
                    } else {
//                        myScroll.refresh();
                        maxScrollY = $(document).height();
                        isLoading = false;
                        $("#msg").html('没有更多商品啦');
                        isFinish = true;
                    }
                }
            });
        }
    });
$(function () {
$("img.lazy").lazyload();
});
</script>        <nav id="show-top-menu">
            <div class="mask" id="menu-mask"></div>
            <div class="menu-content">
                <ul class="main-cat">
                            <li class="cat-item mm-nolistview">
                            <a rel="external" href="/cat.html?node=5" class="cnzzCounter">女装</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=18" class="cnzzCounter" >男装</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=9" class="cnzzCounter" >内衣</a>
                            </li>

                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=3" class="cnzzCounter" >化妆品</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=12" class="cnzzCounter" >居家</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=37" class="cnzzCounter" >箱包皮具</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=14" class="cnzzCounter" >美食</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=32" class="cnzzCounter" >车品</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=16" class="cnzzCounter" >数码</a>
                            </li>
                            <li class="cat-item ">
                            <a rel="external" href="/cat.html?node=46" class="cnzzCounter" >家电</a>
                            </li>
                 </ul>
                <span class="up-menu">收起分类</span>
            </div>
        </nav>
        <div class="toTop">&#xe601;</div>
        <div style="display: none;">
         </div>
        <script src="js/cms_common.js"></script>
        <script>
var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?d5373073631810b88ef122a2937035c6";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script>

</body>
</html>